import * as THREE from "three"

class ScenceHelper {
    opts:any = null;
    constructor(opts:any) {
        this.opts = Object.assign(this.opts, opts)
    }

    gridHelper(parent:any, props = {
        gridWidth: 100,
        gridLenght: 10,
        lineColor: "ccc"
    }){
        //
        // 网格辅助线
        const gridHelper = new THREE.GridHelper(props.gridWidth, props.gridWidth/props.gridLenght, props.lineColor, props.lineColor);
        gridHelper.name = 'helper';
        gridHelper.rotateX(Math.PI * 0.5); 
        parent.add(gridHelper);
    }

    axesHelper(parent:any, lineLenght:number){
        const axes = new THREE.AxesHelper(lineLenght);
        parent.add(axes)
    }

    lightHelper(parent:any, props:any){
        const lightHelper = new THREE.DirectionalLightHelper(props);
        parent.add(lightHelper)
    }
}